home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / OpenDoc / CreditNow! / CreditNow! Source / $Sources / CPCreditNowDemo.Focus.cpp < prev    next >
Encoding:
Text File  |  1995-04-30  |  3.5 KB  |  104 lines  |  [TEXT/MPCC]

  1. //----------------------------------------------------------------------------------------
  2. // Part Activation protocol
  3. //----------------------------------------------------------------------------------------
  4.  
  5. #ifndef _CREDITNOWDEMO_
  6. #include "CPCreditNowDemo.h"
  7. #endif
  8.  
  9. //----------------------------------------------------------------------------------------
  10.  
  11. ODBoolean CPCreditNowDemo::BeginRelinquishFocus(Environment* ev, ODTypeToken focus,
  12.                                               ODFrame* ownerFrame,
  13.                                               ODFrame* proposedFrame)
  14. {
  15.     // CodeWarrior: Cmd-Click or Search:Find Definition • Explain_BeginRelinquishFocus
  16.     EnteringMethod("\pCPCreditNowDemo::BeginRelinquishFocus");
  17.     ODUnused(ownerFrame);
  18.  
  19.     if ((focus == fModalFocus) && (proposedFrame->GetPart(ev) != fSelf)) {
  20.         return kODFalse;
  21.             // What IS ModalFocus, anyway?  The whole purpose of this
  22.             // ModalFocus thing is to restrict frame changes.  This is
  23.             // the part's chance to do this.  But how much to restrict…
  24.             //
  25.             // This is an interesting case.  ModalFocus is kind of a weird
  26.             // concept in OpenDoc, as it goes against the principal of
  27.             // being able to click anywhere at any time.  This implementation
  28.             // keeps the focus on the part.  Note that the implementation
  29.             // of ModalFocus might be more restrictive than this.  You may
  30.             // wish to restrict it to a single frame, instead of allowing
  31.             // the focus to move from frame to frame within a single part.
  32.             // If you wish to restrict it to a single frame, then the if
  33.             // should only check if it is a modal focus.
  34.     }
  35.     else {
  36.         return kODTrue;
  37.             // This is the super-script way of handling ModalFocus.  You
  38.             // can NOT switch off the frame to another, no matter what.
  39.     }
  40. }
  41.  
  42. //----------------------------------------------------------------------------------------
  43.  
  44. void CPCreditNowDemo::CommitRelinquishFocus(Environment* ev,
  45.                                         ODTypeToken focus, ODFrame* ownerFrame,
  46.                                         ODFrame* proposedFrame)
  47. {
  48.     // CodeWarrior: Cmd-Click or Search:Find Definition • Explain_CommitRelinquishFocus
  49.     EnteringMethod("\pCPCreditNowDemo::CommitRelinquishFocus");
  50.     ODUnused(proposedFrame);
  51.  
  52.     this->FocusLost(ev, focus, ownerFrame);
  53. }
  54.  
  55. //----------------------------------------------------------------------------------------
  56.  
  57. void CPCreditNowDemo::AbortRelinquishFocus(Environment* ev,
  58.                                        ODTypeToken focus, ODFrame* ownerFrame,
  59.                                        ODFrame* proposedFrame)
  60. {
  61.     // CodeWarrior: Cmd-Click or Search:Find Definition • Explain_AbortRelinquishFocus
  62.     EnteringMethod("\pCPCreditNowDemo::AbortRelinquishFocus");
  63.     ODUnused(focus);
  64.     ODUnused(ownerFrame);
  65.     ODUnused(proposedFrame);
  66. }
  67.  
  68. //----------------------------------------------------------------------------------------
  69.  
  70. void CPCreditNowDemo::FocusAcquired(Environment* ev, ODTypeToken focus, ODFrame* ownerFrame)
  71. {
  72.     // CodeWarrior: Cmd-Click or Search:Find Definition • Explain_FocusAcquired
  73.     EnteringMethod("\pCPCreditNowDemo::FocusAcquired");
  74.     if (focus == fMenuFocus)
  75.     {
  76.         if (ownerFrame && fMenuBar)
  77.         {
  78.             fMenuBar->Display(ev);
  79.         }
  80.     }
  81. //AET<<
  82.     if (fCurrentField)
  83.         (fCurrentField->GetTextField())->Activate();
  84. //AET>>
  85. }
  86.  
  87. //----------------------------------------------------------------------------------------
  88.  
  89. void CPCreditNowDemo::FocusLost(Environment* ev, ODTypeToken focus, ODFrame* ownerFrame)
  90. {
  91.     // CodeWarrior: Cmd-Click or Search:Find Definition • Explain_FocusLost
  92.     EnteringMethod("\pCPCreditNowDemo::FocusLost");
  93.     ODUnused(ownerFrame);
  94.  
  95.     if (focus == fMenuFocus)
  96.     {
  97.     }
  98. //AET<<
  99.     if (fCurrentField)
  100.         (fCurrentField->GetTextField())->Deactivate();
  101. //AET>>
  102. }
  103.  
  104.